﻿<UserControl x:Class="HartAnalyzer.SpecificCommands.SpecificCommandView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:viewModelLocator="clr-namespace:MEFedMVVM.ViewModelLocator;assembly=MEFedMVVM.WPF"
             mc:Ignorable="d" viewModelLocator:ViewModelLocator.ViewModel="SpecificCommandViewModel"
             d:DesignHeight="300" d:DesignWidth="300">

    <ListView SelectionMode="Single" SelectionChanged="OnCommandListBoxSelectionChanged" ScrollViewer.HorizontalScrollBarVisibility="Disabled"
                      x:Name="CommandListBox" Background="Transparent" KeyboardNavigation.TabNavigation="Continue"
                      ItemsSource="{Binding CommandItems}" SelectedItem="{Binding ActualCommandItem, Mode=TwoWay}">
        <ListView.ItemContainerStyle>
            <Style TargetType="{x:Type ListBoxItem}">
                <Style.Triggers>
                    <Trigger Property="IsKeyboardFocusWithin" Value="True">
                        <Setter Property="IsSelected" Value="True" />
                    </Trigger>
                </Style.Triggers>

                <Setter Property="KeyboardNavigation.IsTabStop" Value="False" />
            </Style>
        </ListView.ItemContainerStyle>
        <ListView.ItemsPanel>
            <ItemsPanelTemplate>
                <WrapPanel  IsItemsHost="True"/>
            </ItemsPanelTemplate>
        </ListView.ItemsPanel>
        <ListView.ItemTemplate>
            <DataTemplate>
                <TextBox Padding="-1.5,0" BorderBrush="Transparent" Margin="2,0"
                                 Text="{Binding Value, NotifyOnValidationError=True, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}">
                </TextBox>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</UserControl>
